package com.athenaeum.datastore.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;

import org.hibernate.annotations.GenericGenerator;

import com.athenaeum.datastore.enums.MailType;
import com.athenaeum.datastore.enums.ReadStatus;

@Entity
@SuppressWarnings("serial")
public class Mail extends AbstractUserAuditFields implements Serializable {
	@Id
	@GeneratedValue(generator = "UUIDGenerator")
	@GenericGenerator(name = "UUIDGenerator", strategy = "com.athenaeum.datastore.util.UUIDGenerator")
	@Column(length = 36)
	private String id;
	
	@Column(columnDefinition="TEXT")
	private String message;
	private String subject;
	
	@Column(columnDefinition="ENUM('INBOX', 'DRAFT', 'SENT', 'OUTBOX', 'JUNK', 'DELETED')")
	private MailType mailType;
	
	@Column(columnDefinition="ENUM('READ','UNREAD')")
	private ReadStatus readStatus;
	
	@OneToMany(targetEntity=MailRecipients.class, cascade=CascadeType.ALL, mappedBy="mailId")
	private Set<MailRecipients> mailRecipients;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public ReadStatus getReadStatus() {
		return readStatus;
	}

	public void setReadStatus(ReadStatus readStatus) {
		this.readStatus = readStatus;
	}

	public Set<MailRecipients> getMailRecipients() {
		return mailRecipients;
	}

	public void setMailRecipients(Set<MailRecipients> mailRecipients) {
		this.mailRecipients = mailRecipients;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public MailType getMailType() {
		return mailType;
	}

	public void setMailType(MailType mailType) {
		this.mailType = mailType;
	}
}
